import multiprocessing
import time
import os

g_list = list()


def add(n):
    for i in range(n):
        print("g_list add", i)
        g_list.append(i)
        time.sleep(0.3)


def read():
    print("read", g_list)


if __name__ == '__main__':
    p1 = multiprocessing.Process(target=add, args=(5,))
    p2 = multiprocessing.Process(target=read, args=())
    p1.start()
    p1.join()
    p2.start()
    p2.join()
    print("main", g_list)
